home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
MATHS
/
RLAB
/
RLAB125.ZIP
/
!RLaB
/
help_jr
/
printf
< prev
next >
Wrap
Text File
|
1994-02-21
|
862b
|
34 lines
printf:
Syntax: printf ( format_string , VARi ... )
Description:
The RLaB printf() is a limited feature version of the
C-language printf(). The features are limited because RLaB
does not support all of the data type the C-language does.
format_string: must be a valid printf format string
VARi: are any number of constants or variables that match the
format string. printf() cannot print out vector, matrix, or
list objects as a whole. Valid print objects are strings,
constants, and scalars.
The following shows how one might print out the annotated
contents of a matrix.
for(i in 0:size(a)[0]-1) {
for(j in 0:size(a)[1]-1) {
printf("a[%i;%i] = %f\n", i, j, a[i;j]);
}
}
It would be more efficient to use:
write("stdout", a);
since write() knows how to deal with entire data objects.
See also: fprintf, sprintf, write, read